How to create Virtual Environment in Python

Python
A tutorial on environements in python
Published

June 1, 2021

This notebook shows, how to create python virtual environment

Different ways of creating python virtual environment

  1. Using yml file
  2. Using conda create command

1. Using yml file

* First create environment.yml file
* conda env create -f environment.yml
environment.yml
name: tablenv 
channels:
  - defaults
dependencies:
  - numpy=1.16.2
  - pandas=0.24.2
  - matplotlib=3.0.3

2. Using conda create command

* conda create --name tablenv <br>
#### for specific version
* conda create -n tablenv python=3.7.7 

Other steps

###### to activate conda env
* conda activate tablenv 
###### to deactivate env
* conda deactivate tablenv 
###### to make available for jupyter notebook
* conda install -c anaconda ipykernel
###### to make available for jupyter notebook
* ipython kernel install --user --name=tablenv
###### to remove environment
* conda env remove -n tablenv
###### list the environment 
*  conda env list
*  conda info -e

References